package com.zut.controller;
import com.zut.config.WxPayConfig;
import com.zut.service.ProductService;
import com.zut.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@Api(tags = "商品管理接口")
@RequestMapping("/api/product")
public class ProductController {

    @Autowired
    private ProductService productService;
    @Autowired
    WxPayConfig wxPayConfig;

    @GetMapping("/test")
    @ApiOperation("测试hello world")
    public R product() {
        System.out.println("hello");
        System.out.println("wxPayConfig.getMchId() = " + wxPayConfig.getMchId());
        return R.ok();
    }

    // 查询所有的课程 产品
    @GetMapping("/list")
    @ApiOperation("查询所有的课程 产品")
    public R list() {
        return R.ok().data("productList", productService.list());
    }
}
